package com.flnet.web.controller.api;

import com.flnet.api.annotation.IgnoreAuth;
import com.flnet.api.domain.Member;
import com.flnet.api.util.ApiBaseAction;
import com.flnet.common.base.AjaxResult;
import com.flnet.common.utils.UUIDUtils;
import com.flnet.api.service.IMemberService;
import com.flnet.common.validator.Assert;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags="注册")
@RestController
@RequestMapping("/api")
public class ApiRegisterController extends ApiBaseAction
{
    @Autowired
    private IMemberService iMemberService;

    @ApiOperation(value = "注册")
    @IgnoreAuth
    @PostMapping("register")
    public AjaxResult register(String mobile, String password){
        Assert.isBlank(mobile,"手机号不能为空");
        Assert.isBlank(password,"密码不能为空");
        Member memberVo = new Member();
        memberVo.setPhone(mobile);
        memberVo.setPassword(password);
        memberVo.setUuid(UUIDUtils.getUUID());
        iMemberService.insertWMember(memberVo);
        return AjaxResult.success();
    }
}